//
//  SystemDetaileViewController.m
//  jingdongfang
//
//  Created by 郝志宇 on 16/9/12.
//  Copyright © 2016年 ZhiYu Hao. All rights reserved.
//

#import "SystemDetaileViewController.h"
#import "OrderXQViewController.h"

@interface SystemDetaileViewController ()

@property (weak, nonatomic) IBOutlet UILabel *timeLab;
@property (weak, nonatomic) IBOutlet UILabel *contentLab;
@property (weak, nonatomic) IBOutlet UIButton *dealButton;

@end

@implementation SystemDetaileViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
//    self.navigationItem.title = @"系统消息";
    self.navigationItem.title = NSLocalizedString(@"System Message", nil);
    self.view.backgroundColor=[UIColor c2Color];
    _timeLab.text= [NSDate timestampToString:self.msgModel.createAt Format:@"yyyy-MM-dd HH:mm"];
    _contentLab.text=self.msgModel.content;
    _dealButton.layer.masksToBounds = YES;
    _dealButton.layer.cornerRadius = 5;
    NSInteger type = [self.msgModel.type integerValue];
    if ([self.msgModel.type integerValue] > 20 && [self.msgModel.type integerValue] < 30) {
        _dealButton.hidden = NO;
        if (type == 21) {
            [_dealButton setTitle:NSLocalizedString(@"Go to Deliver", nil) forState:UIControlStateNormal];
        } else if (type == 22 || type == 23 || type == 26 || type == 27) {
            [_dealButton setTitle:NSLocalizedString(@"Check Order Items", nil) forState:UIControlStateNormal];
        } else if (type == 24 || type == 25) {
            [_dealButton setTitle:NSLocalizedString(@"Go to Process", nil) forState:UIControlStateNormal];
        }
    } else {
        _dealButton.hidden = YES;
    }
}

- (IBAction)dealButtonClick:(id)sender {
    OrderXQViewController *orderVC = [[OrderXQViewController alloc] init];
    orderVC.oid = self.msgModel.listId;
    if ([self.msgModel.type integerValue]==22||[self.msgModel.type integerValue]==23||[self.msgModel.type integerValue]==26) {
        orderVC.isMyBuy=YES;
    }
    [UIViewController ig_pushViewController:orderVC animated:YES];
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
